class MyList:
    def __init__(self, list):
        self.list = list

    def myPop(self):
        newlist = []
        for i in range(len(self.list) - 1):
            newlist.append(self.list[i])
        self.list = newlist
        return self.list

    def mySplice(self, index, count):  # 删除列表中从index开始的count个元素
        for i in range(index, len(self.list) - count):  # 后面的元素朝前移动
            self.list[i] = self.list[i + count]
        for i in range(count):  # 移动完成后调用count次mypop方法来删除末尾的元素
            self.myPop()
        return self.list

    def myInsert(self, index, value):
        # 把self.list的每个元素给newList进行添加, 当下标为index时的那次循环, 多进行一次append操作, 且添加的值是value
        newList = []
        for i in range(len(self.list)):
            if index == i:
                newList.append(value)
            newList.append(self.list[i])
        self.list = newList
        return self.list

    def myAllNumber(self):
        # 检查列表中是否全部都是数字, 如果全是则返回True, 否则返回False
        isNumber = True
        for i in self.list:
            if not isinstance(i, (int)):
                isNumber = False
                break
        return isNumber

    def myCount(self, value):
        # 获取列表中元素值为value的次数, 遍历元素进行判断即可, 这个方法主要提供给myIsDup使用
        count = 0
        for i in self.list:
            if i == value:
                count = count + 1
        return count

    def myIsDup(self):
        # 判断列表中是否出现重复的元素值, 如果有则返回True, 否则返回False
        isDup = True
        for i in self.list:
            if self.myCount(i) > 1:
                isDup = False
                break
        return isDup


if __name__ == '__main__':
    mylist = [1, 2, 3, 4]
    ml = MyList(mylist)
    print(ml.mySplice(2, 1))
